<?php
/**
 * Created by XM·Tan.
 * Motto: Who shuts love out, in turn shall be shut out from love.
 * Date: 2021/4/18 14:54
 */

namespace app\admin\controller;

use app\common\lib\Show;
use think\facade\View;
use app\admin\business\Setting as SettingBus;

class Setting extends AdminBase {

    public $business = null;
    public function __construct() {
        $this->business = new SettingBus();
    }

    public function index() {
        $info = $this->business->getById(1);
        return View::fetch('', [
            'info' => $info,
        ]);
    }

    public function save() {
        $data = input('param.');
        // 执行 business 操作
        $res = (new SettingBus())->edit($data['id'],$data);
        if (!$res) {
            return Show::error('更新失败');
        }
        return Show::success('更新成功');
    }

}